package com.example.system.service.impl;

import com.alipay.api.domain.AlipayAccount;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.system.entity.Payment;
import com.example.system.mapper.OrderMapper;
import com.example.system.mapper.PaymentMapper;
import com.example.system.service.IPaymentService;
import com.example.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 王鹤蒲
 * @since 2024-02-03
 */
@Service
public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, Payment> implements IPaymentService{

    @Autowired
    private PaymentMapper paymentMapper;

    @Autowired
    private IUserService iUserService;



    @Override
    public Integer insert(Payment payment) {
        LocalDateTime createTime=LocalDateTime.now();
        payment.setCreateBy(iUserService.getCurrentLoginUser().getUserName()).setCreateTime(createTime);
        paymentMapper.insert(payment);
        Integer paymentId=payment.getId();
        return paymentId;
    }


}
